/*
 * @Author : Genustin
 * @Date   : 2012-07-12
 * 字符出现次数，输出直方图
 */
#include <iostream>
#include <cstdio>
using namespace std;
 
int  main()
{
	short N = 4;
	int times[26] = {};
	char line;
	for(size_t i = 0; i < 4; ++i)
	{
		scanf("%c", &line);
		while(line != '\n') {
			if(line >= 'A' && line <= 'Z')
				++times[line - 'A'];
			scanf("%c", &line);			
		}
	}
	
	int max = 0;
	for(size_t i = 0; i < 26; ++i)
	{
		if(times[i] > max)
			max = times[i];
	}
	
	for(size_t i = max; i > 0 ; --i)
	{
		for(size_t j = 0; j < 26; ++j)
		{
			if(times[j] == max) {
				cout << '*' << ' ';
				--times[j];
			} else {
				cout << ' ' << ' ';
			}
			
		}
		--max;
		cout << endl;
	}
	cout << "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z " << endl;		
	return 0;
}
